package com.uuah.server.config.spring.parsers.specific.endpoint.support;

import com.uuah.server.config.spring.parsers.generic.ChildDefinitionParser;
import com.uuah.server.config.spring.parsers.processors.AddAttribute;
import com.uuah.server.endpoint.URIBuilder;

/**
 * Generate an Endpoint URI from simple address components.
 */
public class ChildAddressDefinitionParser extends ChildDefinitionParser {

	public static final boolean META = true;
	public static final boolean PROTOCOL = false;

	public ChildAddressDefinitionParser(String protocol) {
		this(protocol, PROTOCOL);
	}

	public ChildAddressDefinitionParser(String metaOrProtocol, boolean isMeta) {
		super(EndpointUtils.URI_BUILDER_ATTRIBUTE, URIBuilder.class);
		registerPreProcessor(new AddAttribute(isMeta ? URIBuilder.META
				: URIBuilder.PROTOCOL, metaOrProtocol));
	}

}
